package com.share.dubbo.es;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import com.share.common.utils.IpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

/**
 * @author 01401061 - 孙艳强
 * @date 2020/10/27 18:09
 */
@Slf4j
@EnableDubbo(scanBasePackages = {"com.share.dubbo.es.service"})
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, ElasticsearchAutoConfiguration.class, RestClientAutoConfiguration.class})
public class AppEs {
    static {
        String ip = IpUtil.getIp();
        System.setProperty("dubbo.protocol.host", ip);
        System.setProperty("DUBBO_IP_TO_REGISTRY", ip);
        System.setProperty("DUBBO_IP_TO_BIND", ip);
        log.info("把ip设置到dubbo.protocol.host系统参数中,ip={}", ip);
    }

    public static void main(String[] args) {
        SpringApplication.run(AppEs.class, args);
    }
}
